package org.rpc.register;

import java.util.HashMap;
import java.util.Map;

public class LocalRegister {
    private static final Map<String, Class<?>> map = new HashMap<>();
    //默认版本号
    private static final String defaultVersion = "1.0";

    //注册方法
    public static void register(String interfaceName, String version, Class<?> clazz) {
        map.put(interfaceName + version, clazz);
    }

    public static void register(String interfaceName, Class<?> clazz) {
        map.put(interfaceName + defaultVersion, clazz);
    }

    //获取方法
    public static Class<?> get(String interfaceName, String version) {
        return map.get(interfaceName + version);
    }

    public static Class<?> get(String interfaceName) {
        return get(interfaceName, defaultVersion);
    }
}
